-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update value in signature file. #1161
Conversation
3b98c88
to
53d17ad
Compare
ec0de39
to
aeb699f
Compare
This can actually be solved quite easily if the newly added extended data is available. @baronfel any ideas on how we want to expose this optional information in the |
@TheAngryByrd I'm able to get the extended data from the diagnostic in the check results. |
This is great @nojaf - using extended data was what came to my mind immediately. Let me take a look at the way you're using it - we may want to think of some kind of protocol for single-fix vs whole-file fixes, for example. |
I know LSP kind of defines categories but they’re not explicit. Had to go looking thru the vscode code to see what was supported. |
Could that be part of a separate effort? I feel like this one is good to go, nothing to lose here. And could someone re-run the failed builds? |
3 of them (mac/ubuntu) seem to be formatting failures.
Is this just newline/encoding nonsense? |
Serious doubt there. Did you re-run them? |
Could this one get merged please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ thank you!
Thanks Jimmy! |
WHAT
🤖 Generated by Copilot at ffe2cca
This pull request adds a new code fix feature that updates the value declaration in a signature file to match the implementation file, and integrates it into the language server and the test suite. It also refactors and cleans up some existing test modules and utilities for code fixes, and adds a new module for a code fix that converts string concatenation to interpolated strings.
🤖 Generated by Copilot at ffe2cca
🧵🔄🧪
WHY
HOW
🤖 Generated by Copilot at ffe2cca
ToInterpolatedString.fix
function converts string concatenation expressions to interpolated strings using the$
syntax (link)UpdateValueInSignatureFile.fix
function updates the value declaration in a signature file to match the implementation file using theFSharpSymbolUse
information (link)ToInterpolatedString.fsi
andUpdateValueInSignatureFile.fsi
declare the public types and values of the new code fix modules (link, link)AdaptiveFSharpLspServer
andFSharpLspServer
types can handle the new code fixes by adding them to the list of code fix providers (link, link)UpdateValueInSignatureFileTests.fs
file contains the test cases for theUpdateValueInSignatureFile
code fix, using thecheckFixAt
function with different document identifiers (link)tests
function inTests.fs
runs the new code fix tests along with the existing ones (link)checkFixAt
function takes a new parametereditsFrom
that specifies the text document identifier from which the code fix edits should be extracted (link)checkFixAt
function applies the code fix edits to the document specified byeditsFrom
, which may not be the same as the document that triggered the code fix (link)checkFix
andcheckFixAll
functions pass the document identifier of the untitled or shared document to thecheckFixAt
function, which is the same as the document that triggered the code fix (link, link)RenameParamToMatchSignatureTests.fs
file adds new lines before eachtestCaseAsync
expression to improve the readability and consistency of the test code (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)RenameParamToMatchSignatureTests.fs
file removes an extra empty line at the end of the module (link)CursorbasedTests.fs
andCursorbasedTests.fsi
files remove some unused open statements from theUtils.CursorbasedTests
module (link, link, link, link)CursorbasedTests.fs
file removes some extra spaces and new lines from thediagnosticsIn
,checkFixAt
, andcheckFixAll
functions (link, link, link, link)Dog feeding #1158 a bit.
I think I'm doing something wrong on the Expecto side.
dotnet run
isn't exiting correctly.The actual code fix needs to be expanded a bit more. I would, however, very much like to have this.
I could use a first round of feedback if anybody is up for it.